//
//  TouchImageView.m
//  Common
//
//  Created by xiong qi on 13-5-15.
//  Copyright (c) 2013年 xiong qi. All rights reserved.
//

#import "TouchImageView.h"

@implementation TouchImageView
@synthesize delegate,dataSource,Type;

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        imageview = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width,frame.size.height)];
        [self addSubview:imageview];
        [imageview release];
    }
    return self;
}

-(void)SetImage:(UIImage *)image
{
    imageview.image = image;
}

-(UIImage *)GetImage
{
    return imageview.image ;
}

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    CGPoint point = [[touches anyObject] locationInView:self];
    
    if (!CGRectContainsPoint(self.bounds,point)) {
       
        return;
    }
    
    if (delegate != nil && [delegate respondsToSelector:@selector(TouchImageViewBeTouch:)]) {
        [delegate TouchImageViewBeTouch:self];
    }
}

-(void)dealloc
{
    self.delegate = nil;
    self.dataSource = nil;
    [super dealloc];
}
@end
